package com.example.demo.singleton;

public class Singleton {

    private final static Singleton instance = new Singleton();
    private volatile static Singleton instance1;

    private Singleton() {

    }

    public static Singleton getInstance(){
        return instance;
    }

    public static Singleton getInstance1(){
        if(instance1 == null){
            synchronized (Singleton.class){
                if (instance1 == null) {
                    instance1 = new Singleton();
                }
            }
        }
        return instance1;
    }






}
